  1 package main
  2
  3 import (
  4     "fmt"
  5 )
  6
  7 var x, y int
  8 var (   //一般作用于全局变量
  9     a int
 10     b bool
 11 )
 12 var c, d int = 1, 2
 13 var e, f = 123, "hello"
 14
 15 func main() {
 16     g, h := 123, &f     //&引用指针地址
 17     f = "777"
 18     fmt.Println(x, y, a, b, c , d, e, f, g, *h)     //*解析指针地址
 19
 20     const LENGTH int = 10
 21     const WIDTH int = 5
 22     var area int
 23     const a, b, c = 1, false, "str"                 //必须使用""
 24     area = LENGTH * WIDTH
 25     fmt.Println("面积为：%d", area)
 26     println()
 27     println(a, b, c)
 28 }
